<template>
  <div>
    <table>
      <tr>
        <th>用户名</th>
        <th>密码</th>
        <th>创建时间</th>
      </tr>

      <tr v-for="(item, index) in Info" :key="index">
        <td></td>

        <td></td>
        <td></td>
        <td><button @click="deleteInfo(item.id)">删除</button></td>
      </tr>
    </table>
    <!-- <van-button @click="getInfo" type="primary">获取数据</van-button> -->
  </div>
</template>

<script setup>
import MyTag from '@/views/MyTag.vue'
import axios from 'axios'
// import { ref } from 'vue'

// const Info = ref('')
//获取数据
// import { useUserStore } from '@/stores/user'
// const userStore = useUserStore()
// const getInfo = () => {
//   axios
//     .get('http://localhost:3000/api/get')
//     .then((res) => {
//       Info.value = res.data
//       userStore.setInfo(res.data)
//       console.log(userStore.user)
//     })
//     .catch((err) => {
//       console.log(err)
//       alert('获取失败')
//     })
// }

//删除数据
const deleteInfo = (index) => {
  console.log('删除', index)
  axios.delete(`http://localhost:3000/api/delete/${index}`).then((res) => {
    console.log(res)
    // getInfo()
  })
}
</script>

<style></style>
